/*
 * dry3.cpp
 *
 *  Created on: 23/06/2011
 *      Author: Yotam and Gilaad
 */

#include <exception>
#include <iostream>
#include <vector> // vector or list
#include <list> // vector or list
using namespace std;


template <typename t, typename s>
class Stack{
	s data;
public:
	class Empty: public exception {};
	void push(const t& value){
		data.push_back(value);
	}
	void pop() {
		if (data.size() == 0){
			throw Empty();
		}
		data.pop_back();
	}
	t top(){
		return data.back();
	}
};

int main() {
	try {
		Stack<int, vector<int> > stack;
		stack.push(1);
		stack.push(2);
		Stack<int, vector<int> > copy = stack;
		copy.pop();
		stack = copy;
		cout << stack.top() << endl;
		stack.pop();
		stack.pop();
	} catch (Stack<int, vector<int> >::Empty& exp) {
		cerr << "Stack is empty" << endl;
	}
return 0;
}
